package com.sinping.qh.service.auth.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sinping.qh.domain.auth.UserRole;
import com.sinping.qh.repository.mysql.dao.UserRoleMapper;
import com.sinping.qh.service.auth.IUserRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘庆沛
 * @since 2017-12-19
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements IUserRoleService {
    @Override
    public List<UserRole> getRolseByUserId(String userId) {
        EntityWrapper<UserRole> userRoleEntityWrapper = new EntityWrapper<>();
        UserRole userRole = new UserRole();
        userRole.setUserId(userId);
        userRoleEntityWrapper.setEntity(userRole);
        List<UserRole> userRoles = this.selectList(userRoleEntityWrapper);
        return userRoles;
    }

    @Override
    public List<UserRole> selectEffectiveUserRoleByRoleId(String roleId) {
        return this.baseMapper.selectEffectiveUserRoleByRoleId(roleId);
    }
}
